package com.shuzijun.leetcode.editor.cn;

import java.util.Stack;

public class YongLiangGeZhanShiXianDuiLieLcof{
    public static void main(String[] args) {
        CQueue solution = new YongLiangGeZhanShiXianDuiLieLcof().new CQueue();
    }
    //leetcode submit region begin(Prohibit modification and deletion)
class CQueue {
       private Stack<Integer> stack = new Stack<>();
       private Stack<Integer> tmpStack = new Stack<>();

        public CQueue() {

        }
    
    public void appendTail(int value) {
        while (!stack.empty()){
            tmpStack.push(stack.pop());
        }

        stack.push(value);
        while (!tmpStack.empty()){
            stack.push(tmpStack.pop());
        }
    }
    
    public int deleteHead() {
        if (stack.empty()) {
            return -1;
        }
        return stack.pop();
    }
}

/**
 * Your CQueue object will be instantiated and called as such:
 * CQueue obj = new CQueue();
 * obj.appendTail(value);
 * int param_2 = obj.deleteHead();
 */
//leetcode submit region end(Prohibit modification and deletion)

}